package operation;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-05-24
 * 22:33
 */
public class returnoperation implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("调用归还图书，，，");
        System.out.println("请输入要归还的图书：");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        for (int i = 0; i < bookList.getSizdUsed(); i++) {
            if (name.equals(bookList.getBooks(i).getName())){
                    bookList.getBooks(i).setBorrow(false);
                System.out.print(bookList.getBooks(i).getName());
                System.out.println("归还成功");
                    return ;
            }
        }
        System.out.println("没有你要归还的图书");
    }
}
